/*  
	------------------------------------------------------------------------
	 NQ Core Library
	
	 Homepage: http://www.awzhome.de/
	------------------------------------------------------------------------
	
	This Source Code Form is subject to the terms of the Mozilla Public
	License, v. 2.0. If a copy of the MPL was not distributed with this
	file, You can obtain one at http://mozilla.org/MPL/2.0/.
   
	The Original Code is code of NQ Core Library.

	The Initial Developer of the Original Code is Andreas Weizel.
	Portions created by the Initial Developer are
	Copyright (C) 2012 Andreas Weizel. All Rights Reserved.
	
	Contributor(s): (none)
	
	------------------------------------------------------------------------
*/

namespace AWZhome.NQ.Core
{
	/// <summary>
	/// Interface for a service that depends on an instance of a parent service.
	/// </summary>
	/// <typeparam name="S">Type of the parent service.</typeparam>
	/// <remarks>
	/// Dependent services additionally implement the
	/// <see cref="AWZhome.NQ.Core.INQDependentService{S}.InitDependent">InitDependent</see>
	/// method to pass the instance of parent service. It must be called after the service
	/// instance has been initialized. The Service Manager offers the
	/// <see cref="AWZhome.NQ.Core.INQServiceManager.CreateDependentService">CreateDependentService</see>
	/// method, that initializes the service and automatically calls the InitDependent method.
	/// </remarks>
	public interface INQDependentService<S>
	{
		/// <summary>
		/// Passes the instance of the parent service to the dependent service.
		/// </summary>
		/// <param name="parent">Instance of parent service.</param>
		/// <remarks>
		/// This method is the place where dependent services should perform their initialization tasks.
		/// </remarks>
		void InitDependent(S parent);

		/// <summary>
		/// Returns the instance of the parent service the dependent service depends on.
		/// </summary>
		S ParentService
		{
			get;
		}
	}
}
